package com.yd.mvc.mobile.noticeController;

import com.yd.app.service.common.LoggerService;
import com.yd.app.service.mobile.noticeService.MNoticeService;
import com.yd.domain.business.Notice;
import com.yd.domain.commom.PageModel;
import com.yd.domain.searchParam.NoticeParam;
import com.yd.domain.sys.Logger;
import com.yd.mvc.baseController.BaseController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;

/**
 * @author zy
 * @create 2018-03-09 14:01
 * @desc 公告的增删改查
 **/
@RestController
@RequestMapping(value = "/mapi/mnotice")
public class MNoticeController extends BaseController {
    @Autowired
    private MNoticeService noticeService;
    @Autowired
    private LoggerService loggerService;
    /**
     * @Author: zy
     * @Desc: 分页查询数据列表
     * @Date:  2018/3/9
     * @Param
     */
    @RequestMapping(value = "/list/{pageIndex}/{pageSize}", method = RequestMethod.POST)
    public PageModel getNoticeList(@RequestBody NoticeParam noticeParam, @PathVariable("pageIndex")int pageIndex, @PathVariable("pageSize")int pageSize){
        PageModel pm=noticeService.getNoticeList(noticeParam,pageIndex,pageSize);
        return pm;
    }

    /**
     * 获取通知公告
     * @return
     */
    @RequestMapping(value = "/get", method = RequestMethod.GET)
    public Notice getNotice(){
        Notice n=null;
        try {
            n=noticeService.getNotice();

        } catch (Exception e) {
            e.printStackTrace();
        }
        return n;
    }


}
